<%@ page import="java.sql.Date" %>
<%@ page import="br.com.rosena.model.bean.persistente.Persistente" %>
<%@ page import="br.com.rosena.model.bean.transiente.ListaRosena" %>
<%
    Persistente objInstituicaoBlog = new Persistente("Instituicao", 1);
    ListaRosena lstEventoBlog = objInstituicaoBlog.getLista("eventos");

    Persistente objEventoBlog = (Persistente) lstEventoBlog.get(0);
    ListaRosena lstBlog = (ListaRosena) objEventoBlog.getLista("blog");
    Persistente USUARIO_LOGADO_SITE = (Persistente) request.getSession().getAttribute("USUARIO_LOGADO_SITE");


%>
<%for (int i = 0; i < lstBlog.size(); i++) {
    Persistente objBlog = (Persistente) lstBlog.get(i);
    ListaRosena lstComentarioBlog = objBlog.getLista("comentarios");
    String titulo = objBlog.getString("titulo");
    String texto = objBlog.getString("descricao");
    Date dataPublicacao = objBlog.getDate("dataPublicacao");
    String mesPublicacao = br.com.rosena.util.Util.mesAno(dataPublicacao);
    String diaPublicacao = br.com.rosena.util.Util.formatarData(dataPublicacao, "dd");
    String anoPublicacao = br.com.rosena.util.Util.formatarData(dataPublicacao, "yyyy");%>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

    <div class="mainbar">
        <div class="article">
            <h2><span><%=titulo%></h2>

            <div class="clr"></div>
            <p>Postado por <a href="#">Admin</a> <span>&nbsp;&bull;&nbsp;</span>

            <p align="justify">
                <%=texto.replace("@quebraLinha@","<br>")%>
            </p>
            <p><a href="#"><strong>Comments (<%=lstComentarioBlog.size()%>)</strong></a> <span>&nbsp;&bull;&nbsp;</span> <%=mesPublicacao%> <%=diaPublicacao%>, <%=anoPublicacao%> <span>&nbsp;&bull;&nbsp;</span>
        </div>
        <div class="article">
            <h2><span><%=lstComentarioBlog.size()%></span> responsta(s)</h2>
            <%for(int j=0;j<lstComentarioBlog.size();j++){%>
                <div class="clr"></div>
                <div class="comment"><a href="#"><img src="images/userpic.gif" width="40" height="40" alt=""class="userpic"/></a>
                    <p><a href="#">admin</a> Says:<br/>
                        April 20th, 2009 at 2:17 pm</p>

                    <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec libero. Suspendisse bibendum.</p>
                </div>
            <%}%>
        </div>
        <%if(USUARIO_LOGADO_SITE != null){%>
            <div class="article">
                <h2><span>Deixe uma</span> Resposta</h2>
                <div class="clr"></div>
                <form action="#" method="post" id="leavereply">
                    <ol>
                        <li>
                            <label for="message">Sua Mensagem</label>
                            <textarea id="message" name="message" rows="8" cols="50"></textarea>
                        </li>
                        <li>
                            <input type="image" name="imageField" id="imageField" src="images/submit.gif" class="send"/>
                            <div class="clr"></div>
                        </li>
                    </ol>
                </form>
            </div>
        <%}%>
    </div>
<%}%>